package com.sumainfor.wx.system.maket.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.system.feign.BaseFeignEpc;
import com.sumainfor.wx.system.feign.BaseFeignGmio;
import com.sumainfor.wx.system.feign.BaseFeignMarket;
import com.sumainfor.wx.system.feign.BaseFeignTenant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 签约流程
 * <p>
 *
 * @author: zc
 * @create: 2019-09-02 18:17
 **/
@RestController
@RequestMapping("/SignProcess")
public class SignProcessController {

    @Autowired
    BaseFeignEpc baseFeignEpc;

    @Autowired
    BaseFeignTenant baseFeignTenant;

    @Autowired
    BaseFeignGmio baseFeignGmio;

    @Autowired
    BaseFeignMarket baseFeignMarket;



    /**
     *租赁顾问签约的时候查询房源的配置列表 公共区域
     */
    @PostMapping("/getHoRdHouConListPublic")
    JsonResult getHoRdHouConListPublic(@RequestBody Map<String,Object> params){
        return baseFeignEpc.getHoRdHouConListPublic(params);
    }


    /**
     *租赁顾问签约的时候查询房源的配置列表 房间 or 房源
     */
    @PostMapping("/getHoRdHouConList")
    JsonResult getHoRdHouConList(@RequestBody Map<String,Object>params){
        return baseFeignEpc.getHoRdHouConList(params);
    }

    /**
     *市场部签合同的时候查询房间智能电表的设备编号
     */
    @PostMapping("/getHoRdInteHpiList")
    JsonResult getHoRdInteHpiList(@RequestBody Map<String,Object>params){
        return baseFeignEpc.getHoRdInteHpiList(params);
    }



    /**
     *查询房源的水电燃收费标准
     */
    @GetMapping("/getChargesDept")
    JsonResult getChargesDept(@RequestParam Map<String,Object> params){
        return baseFeignGmio.getChargesDept(params);
    }


    /**
     *租赁顾问输入房源编号的时候查询该套房以及签约的水燃收费标准
     * @author zhoucong
     * @data 2019/9/2
     * @Param
     * @return
     */
    @GetMapping("/getWgMeter")
    JsonResult getWgMeter(@RequestParam Map<String,Object>params){
        return baseFeignMarket.getWgMeter(params);
    }


    /**
     * 根据房源编号查询活动优惠之后的价格
     */
    @PostMapping("/getOptimalActivity")
    JsonResult getOptimalActivity(@RequestBody Map<String,Object> params){
        return baseFeignMarket.getOptimalActivity(params);
    }




    /**
     * 签约时根据手机号查询微信端的租客信息
     * @author zhoucong
     * @data 2019/9/2
     * @Param
     * @return
     */
    @GetMapping("/getTenantByTenPhone")
    JsonResult getTenantByTenPhone(@RequestParam Map<String,Object> params){
        return baseFeignTenant.getTenantByTenPhone(params);
    }



    /**
     *服务管家退租的时候查询上次的电表抄表数
     */
    @GetMapping("/getHoEleMeter")
    JsonResult getHoEleMeter(@RequestParam Map<String,Object>params){
        return  baseFeignGmio.getHoEleMeter(params);
    }



    /**
     *服务管家退租的时候查询上次的水表抄表数
     */
    @GetMapping("/getHoWaterMeterLast")
    JsonResult getHoWaterMeterLast(@RequestParam Map<String,Object>params){
        return baseFeignGmio.getHoWaterMeterLast(params);
    }



    /**
     * 查询合同的换房信息、转租信息
     */
    @GetMapping("/getRdPactTenList")
    JsonResult getRdPactTenList(@RequestParam Map<String,Object>params){
        return baseFeignMarket.getRdPactTenList(params);
    }


    /**
     *服务管家退租的时候查询上次的燃气抄表数
     */
    @GetMapping("/getHoGasMeterLast")
    JsonResult getHoGasMeterLast(@RequestParam Map<String,Object>params){
        return baseFeignGmio.getHoGasMeterLast(params);
    }



    /**
     * 根据房间id查询整套房源房间信息及房间配置和公共区域配置信息
     */
    @GetMapping("/getHousingInfoByHouInfoId")
    JsonResult getHousingInfoByHouInfoId(@RequestParam Map<String, Object> params){
        return baseFeignMarket.getHousingInfoByHouInfoId(params);
    }


    /**
     *签约时根据手机号查询是否有租客存在如果有就修改租客的信息，如果没有就新增租客
     */
    @PostMapping("/saveOrUpdateTenant")
    public JsonResult saveOrUpdateTenant(@RequestBody Map<String,Object> params){
        return baseFeignMarket.saveOrUpdateTenant(params);
    }


    /**
     * 租赁顾问新签合同时抄水电燃表
     * @param params
     * @return
     */
    @PostMapping("/addHoWegMeter")
    public JsonResult addHoWegMeter(@RequestBody Map<String,Object> params){
        return baseFeignGmio.addHoWegMeter(params);
    }

    /**
     * 获取蜂电电表当前读数
     */
    @PostMapping("/getInteDeviceBeeList")
    public JsonResult getInteDeviceBeeList(@RequestBody Map<String,Object> params){
        return baseFeignMarket.getInteDeviceBeeList(params);
    }



    /**
     *租赁顾问签约的时候查询房源的装修计划预计完成时间
     */
    @GetMapping("/getHoDpiPredictTime")
    public JsonResult getHoDpiPredictTime(@RequestParam Map<String,Object> params){
        return baseFeignEpc.getHoDpiPredictTime(params);
    }


}
